package cn.linran.feign;

import cn.linran.fallback.MovieFeignClientFallbackFactory;
import cn.linran.result.JSONResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author Lin
 * @Date 2022/09/01
 * @Doc 电影假装客户
 **/
@FeignClient(value = "service-movie", fallbackFactory = MovieFeignClientFallbackFactory.class) // 表示是feign接口
@RequestMapping("/movieTicket")
public interface MovieFeignClient {

    /**
     * 查询所有对象
     */
    @RequestMapping(value = "/list",method = RequestMethod.GET)
    JSONResult list();

    /**
     * 电影观看
     * 根据电影Id，查询用户是否拥有此电影票，电影票是否过期，过期提示不可观看
     */
    @RequestMapping(value = "/watch/{id}",method = RequestMethod.GET)
    public JSONResult watchById(@PathVariable("id")Long id);

    /**
     * 根据id购买电影票
     */
    @RequestMapping(value = "/buy/{id}",method = RequestMethod.GET)
    public JSONResult buyById(@PathVariable("id")Long id);

}